import type { PostsModel,postMetaModel} from '@/api/model/postsModel';
import { request } from '@/utils/request';

const Api = {
  Edit:'/archives/edit',
  Delete:'/archives/delete',
  Detail:'/archives/detail',
  All:'/archives/list',
  AllBm:'/bm/list',
  EditBm:'/bm/edit'
};


export function saveArchive(d:any)
{
  return request.post({
    url:Api.Edit,
    data:d
  })
}


export function deleteArchive(id:any)
{
  return request.post({
    url:Api.Delete+'?id='+id,
    data:{}
  })
}

export function getArchive(id:any)
{
  return request.get<PostsModel>({
    url: Api.Detail+`?id=${id}`,
  });
}
export function getAllArchive(d:any)
{
  return request.get<PostsModel>({
    url: Api.All+`?page=${d.current}&pageSize=${d.pageSize}&date=null`,
  });
}


export function getAllBm(d:any)
{
	return request.get<PostsModel>({
	  url: Api.AllBm+`?page=${d.current}&pageSize=${d.pageSize}&date=null`,
	});
}
export function saveBm(d:any)
{
  return request.post({
    url:Api.EditBm,
    data:d
  })
}

export function searchBm(d:any)
{
	return request.post({
	  url:'/bm/search',
	  data:d
	})
}
export function deleteBm(id:number)
{
	return request.delete({
	  url:'/bm/delete?id='+id 
	})
}
